﻿package mortal.game.view.copy.guildDefenseCopy.panel
{
    import Message.DB.Tables.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class GuildDefenseCopyRender extends GCellRenderer
    {
        private var _pic:GImageBitmap;
        private var _enterLevel:GTextFiled;
        private var _txtBg:ScaleBitmap;
        private var _selectBg:ScaleBitmap;
        private var _txtBitMap_1:GImageBitmap;
        private var _txtBitMap_2:GImageBitmap;

        public function GuildDefenseCopyRender()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:Boolean = false;
            this.mouseChildren = false;
            this.mouseEnabled = _loc_1;
            this._pic = UIFactory.gImageBitmap("", 4, 2, this);
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.GuildDefenceCopyTxt_2, 10, 343, this));
            this._txtBitMap_1 = UIFactory.gImageBitmap(ImagesConst.GuildDefenceCopyTxt_3, 10, 368, this);
            this._txtBitMap_2 = UIFactory.gImageBitmap(ImagesConst.GuildDefenceCopyTxt_4, 80, 368, this);
            this._txtBg = UIFactory.bg(16, 368, 155, 22, this, ImagesConst.SkillRune_nameBg);
            this._enterLevel = UIFactory.gTextField("", 38, 368, 110, 20, this, GlobalStyle.textFormatLv.center());
            this._selectBg = UIFactory.bg(0, -2, 185, 404, this, ImagesConst.MountCardSelectBg);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._pic.dispose(param1);
            this._pic = null;
            this._enterLevel.dispose(param1);
            this._enterLevel = null;
            this._txtBitMap_1.dispose(param1);
            this._txtBitMap_1 = null;
            this._txtBitMap_2.dispose(param1);
            this._txtBitMap_2 = null;
            this._txtBg.dispose(param1);
            this._txtBg = null;
            this._selectBg.dispose(param1);
            this._selectBg = null;
            super.disposeImpl(param1);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._pic.imgUrl = "GuildDefenceCopyPic_" + (param1.index + 1);
            this.createStars((param1.index + 1));
            var _loc_2:* = param1.info;
            var _loc_3:* = Cache.instance.guild.selfGuildInfo.baseInfo.level;
            if (_loc_2.level < param1.level)
            {
                this._enterLevel.text = "";
                var _loc_4:Boolean = true;
                this._txtBitMap_2.visible = true;
                this._txtBitMap_1.visible = _loc_4;
                this._txtBg.visible = false;
                this._selectBg.visible = false;
                this._pic.filters = [FilterConst.colorFilter2];
            }
            else if (_loc_2.level == param1.level)
            {
                this._enterLevel.text = Language.getString(35251);
                var _loc_4:Boolean = false;
                this._txtBitMap_2.visible = false;
                this._txtBitMap_1.visible = _loc_4;
                this._txtBg.visible = true;
                this._selectBg.visible = true;
                this._pic.filters = [];
            }
            else
            {
                this._enterLevel.htmlText = Language.getStringByParam(35252, _loc_2.level);
                var _loc_4:Boolean = false;
                this._txtBitMap_2.visible = false;
                this._txtBitMap_1.visible = _loc_4;
                this._txtBg.visible = true;
                this._selectBg.visible = false;
                this._pic.filters = [FilterConst.colorFilter2];
            }
            return;
        }// end function

        private function createStars(param1:int) : void
        {
            var _loc_2:int = 0;
            while (_loc_2 < param1)
            {
                
                this.pushUIToDisposeVec(UIFactory.gBitmap(ImagesConst.PointStar, _loc_2 * 24 + 78, 335, this));
                _loc_2++;
            }
            return;
        }// end function

    }
}
